﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SeleniumLabel.cs" company="">
//   
// </copyright>
// <summary>
//   The selenium label.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.Selenium.SeleniumControls.HtmlControls
{
    using OpenQA.Selenium;

    using UITest.Selenium.SeleniumContext;

    /// <summary>
    ///     The selenium label.
    /// </summary>
    public class SeleniumLabel : SeleniumWebObject
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SeleniumLabel"/> class.
        /// </summary>
        /// <param name="seleniumContext">
        /// The selenium context.
        /// </param>
        /// <param name="findBy">
        /// The find by.
        /// </param>
        public SeleniumLabel(SeleniumContext seleniumContext, By findBy)
            : base(seleniumContext, findBy)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SeleniumLabel"/> class.
        /// </summary>
        /// <param name="seleniumContext">
        /// The selenium context.
        /// </param>
        /// <param name="webElement">
        /// The web element.
        /// </param>
        public SeleniumLabel(SeleniumContext seleniumContext, IWebElement webElement)
            : base(seleniumContext, webElement)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SeleniumLabel"/> class.
        /// </summary>
        /// <param name="seleniumContext">
        /// The selenium context.
        /// </param>
        /// <param name="text">
        /// The text.
        /// </param>
        public SeleniumLabel(SeleniumContext seleniumContext, string text)
            : base(seleniumContext, By.TagName("label"))
        {
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets the label for.
        /// </summary>
        public string LabelFor
        {
            get
            {
                return this.GetWebElement().GetAttribute("for");
            }
        }

        #endregion
    }
}